const Sequelize = require('sequelize')
const { sequelize } = require('../db')
const User = sequelize.define('user', {
  id: {
    type: Sequelize.INTEGER,
    allowNull: false,
    unique: true,
    primaryKey: true,
    autoIncrement: true
  },
  username: {
    type: Sequelize.STRING,
    allowNull: false,
    unique: true
  },
  password: {
    type: Sequelize.STRING,
    allowNull: false
  },
  role: {
    type: Sequelize.ENUM('user', 'admin'),
    allowNull: false
  },
  initialLevel: {
    type: Sequelize.INTEGER
  },
  learnPurpose: {
    type: Sequelize.INTEGER
  },
  planning: {
    type: Sequelize.INTEGER
  },
  learnStyle: {
    type: Sequelize.INTEGER
  }
}, {
  timestamps: false // 取消时间戳
})
User.sync().then(() => {})
module.exports = { User }
